package cn.tedu._04mybatis.mapper;

import cn.tedu._04mybatis.Pojo.entity.Weibo;
import cn.tedu._04mybatis.Pojo.vo.SelectWeiboVO1;
import cn.tedu._04mybatis.Pojo.vo.SelectWeiboVO2;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface WeiboMapper {
    /**
     * 插入微博
     * */
//    @Insert(" INSERT INTO weibo(content, created,user_id) " +
//            "VALUES(#{content},#{created},#{userId})")
    void insertWeibo(Weibo weibo);

    /**
     * 删除指定微博
     */
//    @Delete("DELETE FROM weibo WHERE id = #{id}")
    int deleteWeibo(Long id);

//    @Update("UPDATE weibo SET content=#{content},created=#{created},user_id=#{userId} WHERE id=#{id}")
    int updateWeibo(Weibo weibo);

//    @Select("SELECT id,content,created,user_id FROM weibo WHERE id=#{weiboid}")
    int selectWeiboById(Long weiboid);

//    @Select("SELECT id,content,created,user_id userId FROM weibo")
    List<Weibo> selectWeibo();

//    @Select("SELECT content , created  FROM weibo WHERE id = #{weiboId}")
    SelectWeiboVO1 selectWeiboVO1(Long weiboId);

//    @Select("SELECT id,content FROM weibo WHERE user_id = #{userId}")
    List<SelectWeiboVO2>  selectWeiboVO2(Long userId);




}
